<div id="content" style="width: 650px;">
<?php 
if ($_GET["id"]){
	$server=MINE_server_detail($_GET["id"]);
	
	if ($server["server"] <> null){
	
	$status=MINE_get_state($server["server"]["url"]);
	$kommen=SERVER_kommentar_list($_GET["id"]);
	
	if ($status["state"] == 'Online'){
		$Status_Str = "Online ".$status["online"]."/".$status["max"];
	}else{
		$Status_Str = "Offline";
	}
	
	function slector($id){
		global $server;
		switch($server["server"][$id]){
			case 'f':
				return t("Nein");
			case 't':
				return t("Ja");
		}
	}
	
	?>
	<a name='status'></a>
	<table><tr><td width='300px'>
		<table border=0>
			<tr><td><?=t("Mitspieler")?> 				</td><td><?=$Status_Str?></td></tr>
			<tr><td><?=t("Server Name")?> 				</td><td><?=$status["name"]?></td></tr>
			<tr><td><?=t("Server Adresse")?> 			</td><td onclick="javascript:prompt('<?=t("Copy and paste text below into your multiplayer window")?>', '<?=$server["server"]["url"]?>');"><img src="img/flags/<?=$server["server"]["land"]?>.png" /> <a><?=$server["server"]["url"]?></a></td></tr>
			<?php if ($server["server"]["link"] <> ''){?>
				<tr><td><?=t("Webseite")?>				</td><td><a href="<?=$server["server"]["link"]?>" target="_blank" >Link</a></td></tr>
			<?php }?>
			
			<tr><td><?=t("Verwundbar?")?> 				</td><td><?=slector('verw')?></td></tr>
			<tr><td><?=t("Kann man sich bekämfen?")?> 	</td><td><?=slector('kampf')?></td></tr>
			<tr><td><?=t("Gib es Monster?")?> 			</td><td><?=slector('monster')?></td></tr>
			<tr><td><?=t("Gib es Tiere?")?> 			</td><td><?=slector('tiere')?></td></tr>
			<tr><td><?=t("Kann jeder mitbaun?")?> 		</td><td><?=slector('freib')?></td></tr>
			<tr><td><?=t("Offline-Mode?")?> 			</td><td><?=slector('offmode')?></td></tr>
			
			<tr><td><?=t("Administrator")?> 			</td><td><?php
			$set = $server["admin"];
			while( list ( $key, $val ) = each ( $set ) ){
				echo "<a href='admin-".urlencode($val["name"]).".html'>".$val["name"]."</a> ";
			}
			?></td></tr>
		</table>	
	</td><td>&nbsp;&nbsp;&nbsp;</td><td>
		<big><div>
			<?=$server["server"]["page"]?>
		</div></big>
	</td></tr></table>
	
</div>


	<a name='men'></a>
	<div id="servermenu">
		<ul>
			<li id='home_button' class='norm'><a href='#men' onclick='ShowById("home");' ><?=t("Home")?> </a></li>
			<li id='bilder_button' class='norm'><a href='#men' onclick='ShowById("bilder");' ><?=t("Bilder")?> </a></li>
			<li id='rss_button' class='norm'><a href='#men' onclick='ShowById("rss");' ><?=t("News")?> </a></li>
			<li id='kommantare_button' class='norm'><a href='#men' onclick='ShowById("kommantare");' ><?=t("Kommentare")?> </a></li>
			<li id='craft_button' class='norm'><a href='#men' onclick='ShowById("craft");' ><?=$server["server"]["count"]." ".t("gaben hier")?> <img  style="z-index: 1; position:relative; top: 5px;" src='img/p1.png' /></a></li>
		</ul>
	</div>

<div id="content" style="width: 650px;">

<?php
	echo "<div id='home' style='display: none;'>";
	if ($server["server"]["logo"]){
		echo "<img width='650'  src='{$server["server"]["logo"]}' alt='Logo' title='Logo von {$server["server"]["name"]}'>";
	}
	echo "<div>{$server["server"]["text2"]}</div>";	
	echo "</div>";

	echo "<div id='bilder' style='display: none;'>";
	if ($server["server"]["galerie"]){
		$set = explode("\r",$server["server"]["galerie"]);
		while( list ( $key, $val ) = each ( $set ) ){
			echo "<a href='$val' rel='lightbox[roadtrip]'><img src='$val' height='100' alt='' /></a>";
		}	
	}else{
		echo t("<h2>Zu diesem Server gibt es noch keiner Bilder</h2>");	
	}
	echo "</div>";	
	
	echo "<div id='rss' style='display: none;'>";
	if ($server["server"]["rss"]){
		echo "<a name='news'></a><h2>".t("News von")." {$server["server"]["name"]}</h2>";
		getRssfeed($server["server"]["rss"],"rss","auto",5,2);
	}else{
		echo "<a name='news'></a><h2>{$server["server"]["name"]} ".t("hat keine News")."</h2>";
	}
	echo "</div>";
	
	echo "<div id='kommantare' style='display: none;'>"; 
	if ($kommen == null){
		echo t("<h2>Diesen Server hat noch niemend Kommentiert</h2><br />Sei der Erste und Schreib ein")." <a href='vote-{$server["server"]["id"]}-1.html'>".("Kommentar")."</a>";
	}else{
		echo t("Schreib selber ein")." <a href='vote-{$server["server"]["id"]}-1.html'>".t("Kommentar")."</a><br />
		<table border=1 width='100%'>";
		while( list ( $key, $val ) = each ( $kommen ) ){?>
			<tr><td>
				<div style='float: left;'><h2><?=t("Kommentar von")?> <u><?=$val["autor"]?></u></h2></div>
				<div style='float: right'><ul class="rating r<?=substr($val["vote"],0,1)?>"></ul></div> 
				<div style='float: right'><?=t("vom:")?> <?=substr($val["date"],8,2).".".substr($val["date"],5,2).".".substr($val["date"],0,4)?></div>
				
				<br /><br />
				
				<div><?=$val["text"]?></div>				
				
			</td></tr>
		<?php }
		echo "</table>";
	}
	echo "</div>";
	
	?>
	<div id='craft' style='display: none;'>
		<form method=post action='<?=urlencode($server["server"]["name"])?>_<?=$server["server"]["id"]?>c.html'>
			<h2><?=t("Gefält dier dieser Minecraft Server?")?></h2>
			<h3><?=t("Wenn du dem Server deine Stimme geben willst trage die Zahlen in das Feld ein.")?></h3>
			<img src="data:image/PNG;base64,<?=base64_encode(CAPTCHA_gen())?>">
			<input type=hidden name=check value='<?=md5($_CAPTCHA.$_GET["id"].$config["sec"]["img"].date('Ymd').$_SERVER["REMOTE_ADDR"])?>' /><br />
			<input name=code /><br />
			<input type=submit value='<?=t("Weiter")?>' />	
		</form>	
	</div>
	
	
	<script type="text/javascript">
	 <!--
	 ShowById("<?=$_GET["open"]?$_GET["open"]:"home"?>");
	 //-->
	</script>
	
	<noscript>
  		<big>You nead Javascript to use this page</big>
	</noscript>
	
	<?php 
	}else{
		echo "<h2>".t("Der Server konnte nicht gefunden werden")."</h2>";	
	}
}else{
	
	echo "<table border=1 width='100%'>
	<tr><th>".t("Name")."</th><th colspan=1>".t("Gehisst Flaggen")."</th><th>".t("Version")."</th><th>".t("Bewertung")."</th><th>".t("Punkte")."</th></tr>";
	
	$list = MINE_server_list();
	while( list ( $key, $val ) = each ( $list ) ){?>
		<tr>
			<td>
				<img src="state-<?=urlencode($val["url"])?>.png" />
				<a href='<?=urlencode($val["name"])?>_<?=$val["id"]?>.html'><?=$val["name"]?></a>
			</td>
			<td>
				<img src="img/flags/<?=$val["land"]?>.png" 		TITLE="<?=t("Land").": ".$val["land"]?>"/>
				<img src="img/freib-<?=$val["freib"]?>.png" 	TITLE="<?=t("Jeder kann ".(($val["freib"]=='f')?'nicht ':'')."mitbauen")?>"/>
				<img src="img/verw-<?=$val["verw"]?>.png" 		TITLE="<?=t("Ich kann ".(($val["verw"]=='f')?'nicht ':'')."sterben")?>"/>
				<img src="img/kampf-<?=$val["kampf"]?>.png" 	TITLE="<?=t("Ich kann mit ".(($val["kampf"]=='f')?'niemand ':'jemand ')."kämpfen")?>"/>
				<img src="img/monster-<?=$val["monster"]?>.png" TITLE="<?=t("Es gibt ".(($val["monster"]=='f')?'keine ':'')."Monster")?>"/>
				<img src="img/tiere-<?=$val["tiere"]?>.png"		TITLE="<?=t("Es gibt ".(($val["tiere"]=='f')?'keine ':'')."Tiere")?>"/>
				<img src="img/offmode-<?=$val["offmode"]?>.png" TITLE="<?=t("Der Server ist im ".(($val["offmode"]=='f')?'Online ':'Offline ')."Modus")?>"/>
			</td>
			
			<td><?=$val["version"]?></td>
			<td><ul class="rating r<?=substr($val["vote"],0,1)?>">
				<li class="v1"><a href="<?=$_SESSION["auth"]?"vote-".$val["id"]."-1.html":"auth.html" ?>" title="1 Star">1</a></li>
				<li class="v2"><a href="<?=$_SESSION["auth"]?"vote-".$val["id"]."-2.html":"auth.html" ?>" title="2 Stars">2</a></li>
				<li class="v3"><a href="<?=$_SESSION["auth"]?"vote-".$val["id"]."-3.html":"auth.html" ?>" title="3 Stars">3</a></li>
				<li class="v4"><a href="<?=$_SESSION["auth"]?"vote-".$val["id"]."-4.html":"auth.html" ?>" title="4 Stars">4</a></li>
				<li class="v5"><a href="<?=$_SESSION["auth"]?"vote-".$val["id"]."-5.html":"auth.html" ?>" title="5 Stars">5</a></li>
			</ul></td>
			<td align="center"><big><?=$val["count"]+0?></big></td>			
		</tr>
	<?php }
	
	echo "</table>";
} 